using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MCWEBSITE.BUL;
using MCWEBSITE.ENTITY; 

public partial class Modules_HugKid_wucLeftMenu : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindProductList();
    }

    protected void BindProductList() {
        List<websiteProductCategoryInfo> lstProductParent = websiteProductCategoryBUL.GetCategoryByLangAndParent("vi-VN", "0");
        ltrProductList.Text = "<ul id=\"menu\">";
        foreach (websiteProductCategoryInfo objProductCat in lstProductParent) {
            List<websiteProductCategoryInfo> lstProductChild = websiteProductCategoryBUL.GetCategoryByLangAndParent("vi-VN", objProductCat.CategoryID.ToString());
            if (lstProductChild.Count > 0)
            {
                ltrProductList.Text += "<li><a href=\"Default.aspx?Page=ProductListByCat&ProductCat=" + objProductCat.CategoryID + "\">" + objProductCat.CategoryName + "</a><ul style=\"display: block;\">";
                for (int i = 0; i < lstProductChild.Count; i++) {
                    ltrProductList.Text += "<li><a href=\"Default.aspx?Page=ProductListByCat&ProductCat=" + lstProductChild[i].CategoryID + "\">" + lstProductChild[i].CategoryName + "</a></li>";                
                }
                ltrProductList.Text += "</ul></li>";
            }
            else {
                ltrProductList.Text += "<li><a href=\"Default.aspx?Page=ProductListByCat&ProductCat=" + objProductCat.CategoryID + "\">" + objProductCat.CategoryName + "</a></li>";
            }            
        }
        ltrProductList.Text += "</ul>";
    }
}
